home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / Libraries / VideoToolbox 96.06.15 / VideoToolboxSources / RestoreCluts.c < prev    next >
Text File  |  1995-07-26  |  2KB  |  47 lines

  1. /*
  2. RestoreCluts.c
  3. Developing programs that modify the clut can be annoying, because one frequently
  4. aborts the program for one reason or another and then faces an editing environment
  5. in which text is hard to see because of the weird clut settings. No longer.
  6.  
  7. Somewhere near the beginning of your program insert the line:
  8.  
  9. AtExitToShell(RestoreCluts);
  10.  
  11. This requests that RestoreCluts() be run when you quit, even if
  12. it's an abnormal exit, e.g. escape to shell from MacsBug.
  13. (AtExitToShell is equivalent to the non-ANSI _atexit() routine provided
  14. by the THINK C environment.)
  15.  
  16. CAUTION: the atexit(), and _atexit() routines should not be used in
  17. MATLAB code resources. The reason is that they will only be invoked when MATLAB
  18. exits, after your code resources have already been flushed, so you'll crash.
  19. At this writing (7/1/95) it's safe to call AtExitToShell(), but it will have
  20. no effect if MATLAB is true.
  21.  
  22. For reasons that I don't understand, Apple's RestoreDeviceClut doesn't seem to 
  23. do anything, even though my GDRestoreDeviceClut works fine.
  24.  
  25. HISTORY:
  26. 4/25/92 dgp    wrote it. Why didn't I think of this sooner?
  27. 12/8/92 dgp simplified code, based on Apple's Snippet: 
  28.             RestoreColorsSlam() in ColorReset.c.
  29. 12/9/92    dgp    replaced call to Apple's RestoreDeviceClut by my GDRestoreDeviceClut, 
  30.             since Apple's routine doesn't seem to do anything.
  31. 12/15/92 dgp Renamed to GDRestoreDeviceClut for consistentcy with
  32.             Apple's capitalization of RestoreDeviceClut.
  33. 2/22/93  dhb & dgp Converted for MATLAB
  34. */
  35.  
  36. #include "VideoToolbox.h"
  37. //#include <Menus.h>
  38.  
  39. void RestoreCluts(void)
  40. {
  41.     // RestoreDeviceClut(NULL);    //  Apple's version, restore all cluts
  42.     GDRestoreDeviceClut(NULL);    // my version, restore all cluts
  43.     // Apple suggests making these two calls as well, to force redrawing of
  44.     // everything.
  45.     PaintBehind(NULL,GetGrayRgn());
  46.     DrawMenuBar();
  47. }